<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="frm2">
		<p:growl id="msgs2" showDetail="true" />
		<h:panelGrid columns="4" cellspacing="10">			
			<p:outputLabel value="流程实例(业务编号)："></p:outputLabel>
			<p:inputText value="#{wfmStartMgrMB.serviceid}"></p:inputText>
			<p:commandButton id="squery" value="查询" icon="ui-icon-search"
				action="#{wfmStartMgrMB.queryServiceLogList()}"
				update=":tabview:frm2:dtServices">
				<f:setPropertyActionListener value="#{appShiroValidate.userno}"
					target="#{wfmStartMgrMB.operator}" />
			</p:commandButton>
		</h:panelGrid>
		<p:dataTable id="dtServices" var="row"
			value="#{wfmStartMgrMB.voListLog}" selectionMode="single"
			selection="#{wfmStartMgrMB.selectedServiceLog}" rowKey="#{row.id}"
			resizableColumns="true" liveResize="true" style="margin-bottom:1px;" emptyMessage="没有记录" 
			rows="10" paginator="true" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15" >

			<p:ajax event="rowSelect"
				listener="#{wfmStartMgrMB.onServiceLogRowSelect}"
				update=":tabview:frm2:taskHistPanel :tabview:frm2:diagramPanel" />
			<p:ajax event="rowUnselect"
				listener="#{wfmStartMgrMB.onServiceLogRowUnselect}"
				update=":tabview:frm2:msgs2" />

			<p:column headerText="流程名称" sortBy="#{row.wfmProcess.displayName}" filterBy="#{row.wfmProcess.displayName}"	filterMatchMode="contains">
				<h:outputText value="#{row.wfmProcess.displayName}" />
			</p:column>
			<p:column headerText="流程实例" style="width:150px;" 
				sortBy="#{row.id}" filterBy="#{row.serviceNo}"	filterMatchMode="contains">
				<h:outputText value="#{row.serviceNo}" title="#{row.serviceNo}" />
			</p:column>
			<p:column headerText="创建人">
				<h:outputText value="#{row.creator}" />
			</p:column>
			<p:column headerText="创建时间">
				<h:outputText value="#{fn:substring(row.createTime, 0, 4)}-#{fn:substring(row.createTime, 4, 6)}-#{fn:substring(row.createTime, 6, 8)} #{fn:substring(row.createTime, 8, 10)}:#{fn:substring(row.createTime, 10, 12)}:#{fn:substring(row.createTime, 12, 14)}" />
			</p:column>
			<p:column headerText="更新人">
				<h:outputText value="#{row.lastUpdator}" />
			</p:column>
			<p:column headerText="更新时间">
				<h:outputText value="#{fn:substring(row.lastUpdateTime, 0, 4)}-#{fn:substring(row.lastUpdateTime, 4, 6)}-#{fn:substring(row.lastUpdateTime, 6, 8)} #{fn:substring(row.lastUpdateTime, 8, 10)}:#{fn:substring(row.lastUpdateTime, 10, 12)}:#{fn:substring(row.lastUpdateTime, 12, 14)}" />
			</p:column>
			<p:column headerText="当前节点">
				<h:outputText value="#{row.currentNodeName}" />
			</p:column>
			<p:column headerText="上级节点">
				<h:outputText value="#{row.parentNodeName}" />
			</p:column>
		</p:dataTable>
		
		<p:panel id="taskHistPanel" header="任务完成信息" style="margin-bottom:5px">
			<p:dataTable id="dtHistTask" var="trow"
				value="#{wfmStartMgrMB.voTaskLog}"
				rendered="#{not empty wfmStartMgrMB.selectedServiceLog}">

				<p:column headerText="任务编号" style="width:150px;" sortBy="#{trow.id}">
					<h:outputText value="#{trow.id}" />
				</p:column>
				<p:column headerText="流程节点">
					<h:outputText value="#{trow.taskName}" />
				</p:column>
				<p:column headerText="任务名称">
					<h:outputText value="#{trow.displayName}" />
				</p:column>
				<p:column headerText="任务类型">
					<h:outputText value="#{trow.taskType == 2 ? '协办任务' : '主办任务'}&nbsp;" />
				</p:column>
				<p:column headerText="参与类型">
					<h:outputText
						value="#{trow.performType == 2 ? '会签任务' : '普通任务'}&nbsp;" />
				</p:column>
				<p:column headerText="操作人员">
					<h:outputText value="#{trow.operator}" />
				</p:column>
				<p:column headerText="创建时间">
					<h:outputText value="#{fn:substring(trow.createTime, 0, 4)}-#{fn:substring(trow.createTime, 4, 6)}-#{fn:substring(trow.createTime, 6, 8)} #{fn:substring(trow.createTime, 8, 10)}:#{fn:substring(trow.createTime, 10, 12)}:#{fn:substring(trow.createTime, 12, 14)}" />
				</p:column>
				<p:column headerText="完成时间" sortBy="#{trow.finishTime}">
					<h:outputText value="#{fn:substring(trow.finishTime, 0, 4)}-#{fn:substring(trow.finishTime, 4, 6)}-#{fn:substring(trow.finishTime, 6, 8)} #{fn:substring(trow.finishTime, 8, 10)}:#{fn:substring(trow.finishTime, 10, 12)}:#{fn:substring(trow.finishTime, 12, 14)}" />
				</p:column>

			</p:dataTable>
		</p:panel>
		
		<p:panel id="diagramPanel" header="流程图示" style="margin-bottom:5px" toggleable="true">
			<p:panelGrid rendered="#{not empty wfmStartMgrMB.selectedServiceLog}">
				<p:diagram value="#{wfmStartMgrMB.model}" style="height:400px" styleClass="ui-widget-content" />				
			</p:panelGrid>
		</p:panel>					
				
	</h:form>

</ui:composition>
